﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;
using TL_Cloud.Models.BookShop;
using TL_Cloud.ViewModels.BookShop.BKInfo;

namespace TL_Cloud.ViewModels.BookShop.BKComment
{
    /// <summary>
    /// 评论资源
    /// </summary>
    public class BKCommentResource : BKInfoBasicResource
    {
        public string CommentId { get; set; }
        public string BookId { get; set; }
        public string CommentUserId { get; set; }
        public string Content { get; set; }
        public string CommentUserName { get; set; }

        public DateTime? CreateDate { get; set; }
      
    }


    public class BKCommentMappingProfile : Profile
    {
        public BKCommentMappingProfile()
        {
            CreateMap<Bk_Comment, BKCommentResource>()
                .ForMember(dest => dest.BookName, opt => opt.MapFrom(src => src.bookInfo.BookName))
                .ForMember(dest => dest.BKTypeId, opt => opt.MapFrom(src => src.bookInfo.BKTypeId))
                .ForMember(dest => dest.Author, opt => opt.MapFrom(src => src.bookInfo.Author))
                .ForMember(dest => dest.Pulisher, opt => opt.MapFrom(src => src.bookInfo.Pulisher))
                .ForMember(dest => dest.Isbn, opt => opt.MapFrom(src => src.bookInfo.Isbn))
                .ForMember(dest => dest.ConverUrl, opt => opt.MapFrom(src => src.bookInfo.ConverUrl))
                .ForMember(dest => dest.Introduce, opt => opt.MapFrom(src => src.bookInfo.Introduce))
                .ForMember(dest => dest.Remark, opt => opt.MapFrom(src => src.bookInfo.Remark));
        }
    }

}
